﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title>Replace Tags</title>
	<link href="styles/js-console.css" rel="stylesheet" />
	<script src="scripts/string-extensions.js"></script>
</head>
<body>							  

	<div id="js-console"></div>
	<script src="scripts/js-console.js"></script>
	<script>

	    var text = "<p>Please visit <a href='http://academy.telerik. com'>our site</a> to choose a training course. Also visit <a href='www.devbg.org'>our forum</a> to discuss the courses.</p>";
	    var index = text.indexOf("<a");
	    while (index > -1) {
	        text = text.replace("<a", "[URL");
	        text = text.replace("</a>", "[/URL]");
	        // text = text.replace("\>", "]");
	        index = text.indexOf("<a", index + 1);
	    }

	    jsConsole.writeLine(text);
	</script>

</body>
</html>